import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '../views/Login.vue'
import GuidePage from '../views/GuidePage.vue'
import Home from '../views/Home.vue'
import Welcome from '../views/Welcome.vue'
import refresh from '../views/refresh.vue'

import OwnerInfo from '../views/owner/ownerHouse/OwnerInfo.vue'
import HouseFile from '../views/house/houseCount/HouseFile.vue'
import AreaInfo from '../views/house/board/AreaInfo.vue'
import Community from '../views/house/board/Community.vue'
import StreetOffice from '../views/house/board/StreetOffice.vue'
import Change from '../views/house/houseChange/Change.vue'
import Build from '../views/house/buildInfo/Build.vue'
import Unit from '../views/house/buildInfo/Unit.vue'
import ComeInRecord from '../views/owner/ownerHouse/ComeInRecord.vue'
import EventRepair from '../views/owner/eventManage/EventRepair.vue'
import ComplainItem from '../views/owner/eventManage/ComplainItem.vue'
import ChargeList from '../views/administrative/financial/ChargeList.vue'
import ComplainAdvice from '../views/owner/eventManage/ComplainAdvice.vue'
import RefundRecord from '../views/administrative/financial/RefundRecord.vue'
import ChargeRecord from '../views/administrative/financial/ChargeRecord.vue'
import ChargeProject from '../views/administrative/financial/ChargeProject.vue'
import ChargeWays from '../views/administrative/financial/ChargeWays.vue'
import PayInfo from '../views/administrative/financial/PayInfo.vue'
import IncomeInfo from '../views/administrative/financial/IncomeInfo.vue'
import FamilyInfo from '../views/owner/familyMember/FamilyInfo.vue'
import DialPrivate from '../views/owner/reportManage/DialPrivate.vue'
import DialRecord from '../views/owner/reportManage/DialRecord.vue'
import Department from '../views/administrative/attendance/Department.vue'
import Station from '../views/administrative/attendance/Station.vue'
import Clerk from '../views/administrative/attendance/Clerk.vue'
import Records from '../views/administrative/attendance/Records.vue'
import Material from '../views/logistics/materialhouse/Material.vue'
import HouseInfo from '../views/logistics/materialhouse/HouseInfo.vue'

import MaterialTwo from '../views/logistics/materialhouse/MaterialTwo.vue'
import MaterialIn from '../views/logistics/materialhouse/MaterialIn.vue'
import MaterialOut from '../views/logistics/materialhouse/MaterialOut.vue'
import MaterialBuy from '../views/logistics/materialhouse/MaterialBuy.vue'
import Inventory from '../views/logistics/materialhouse/Inventory.vue'
import FileManage from '../views/administrative/office/FileManage.vue'
import FilePermission from '../views/administrative/office/FilePermission.vue'
import EmployeeContract from '../views/administrative/office/EmployeeContract.vue'
import Notice from '../views/administrative/office/Notice.vue'
import WorkPlan from '../views/administrative/office/WorkPlan.vue'
import MeetingRecord from '../views/administrative/office/MeetingRecord.vue'



Vue.use(VueRouter)

const routes = [
  { path: '/', redirect: '/login' },
  { path: '/login', component: Login },
  { path: '/login/select', component: GuidePage },
  {
    path: '/home',
    component: Home,
    redirect: '/center/welcome',
    children: [
      { path: '/center/welcome', component: Welcome },
      { path: '/housebase/board/areaInfo', component: AreaInfo },
      { path: '/housebase/board/community', component: Community },
      { path: '/housebase/board/streetOffice', component: StreetOffice },
      { path: '/owner/ownerHouse/ownerInfo', component: OwnerInfo },
      { path: '/house/houseCount/houseFile', component: HouseFile },

      // 后勤管理-保洁管理
      {
        path: "/logistics/clean/cleanPlan",
        name: 'cleanPlan',
        component: () => import('../views/logistics/clean/cleanPlan.vue'),
        meta: {
          title: '保洁计划'
        }
      },
      {
        path: "/logistics/clean/cleanEquipmentRecord",
        name: 'cleanEquipmentRecord',
        component: () => import('../views/logistics/clean/cleanEquipmentRecord.vue'),
        meta: {
          title: '保洁工具使用记录'
        }
      },

      // 后勤管理-绿化管理
      {
        path: '/logistics/green/plantInfo',
        name: 'plantInfo',
        component: () => import('../views/logistics/green/plantInfo.vue'),
        meta: {
          title: '植被信息'
        }
      },
      {
        path: '/logistics/green/plantType',
        name: 'plantType',
        component: () => import('../views/logistics/green/plantType.vue'),
        meta: {
          title: '植被类型'
        }
      },
      {
        path: '/logistics/green/plantTypeChildren',
        name: 'plantTypeChildren',
        component: () => import('../views/logistics/green/plantTypeChildren.vue'),
        meta: {
          title: '植被二级类型'
        }
      },
      {
        path: '/logistics/green/plantAreaInfo',
        name: 'plantAreaInfo',
        component: () => import('../views/logistics/green/plantAreaInfo.vue'),
        meta: {
          title: '绿化区域信息'
        }
      },
      {
        path: '/logistics/green/plantEventPlan',
        name: 'plantEventPlan',
        component: () => import('../views/logistics/green/plantEventPlan.vue'),
        meta: {
          title: '绿化计划'
        }
      },

      // 后勤管理-设备管理
      {
        path: '/logistics/equipment/equipmentInfoFile',
        name: 'equipmentInfoFile',
        component: () => import('../views/logistics/equipment/equipmentInfoFile.vue'),
        meta: {
          title: '设备基本信息'
        }
      },
      {
        path: '/logistics/equipment/equipmentType',
        name: 'equipmentType',
        component: () => import('../views/logistics/equipment/equipmentType.vue'),
        meta: {
          title: '设备类型'
        }
      },
      // {
      //   path: '/logistics/equipment/equipmentTypeChildren',
      //   name: 'equipmentTypeChildren',
      //   component: () => import('../views/logistics/equipment/equipmentTypeChildren.vue'),
      //   meta: {
      //     title: '设备二级类型'
      //   }
      // },
      {
        path: '/logistics/equipment/equipmentRepair',
        name: 'equipmentRepair',
        component: () => import('../views/logistics/equipment/equipmentRepair.vue'),
        meta: {
          title: '维保单位信息'
        }
      },
      {
        path: '/logistics/equipment/equipmentMaintainRecord',
        name: 'equipmentMaintainRecord',
        component: () => import('../views/logistics/equipment/equipmentMaintainRecord.vue'),
        meta: {
          title: '保养记录'
        }
      },
      {
        path: '/logistics/equipment/equipmentRepairRecord',
        name: 'equipmentRepairRecord',
        component: () => import('../views/logistics/equipment/equipmentRepairRecord.vue'),
        meta: {
          title: '维修记录'
        }
      },
      {
        path: '/logistics/equipment/equipmentRepairMeterial',
        name: 'equipmentRepairMeterial',
        component: () => import('../views/logistics/equipment/equipmentRepairMeterial.vue'),
        meta: {
          title: '维修用料'
        }
      },
      {
        path: '/logistics/equipment/equipmentCheckRecord',
        name: 'equipmentCheckRecord',
        component: () => import('../views/logistics/equipment/equipmentCheckRecord.vue'),
        meta: {
          title: '巡检记录'
        }
      },
      {
        path: '/logistics/equipment/equipmentMaintain',
        name: 'equipmentMaintain',
        component: () => import('../views/logistics/equipment/equipmentMaintain.vue'),
        meta: {
          title: '设备保养'
        }
      },

      // 后勤管理-安保管理
      {
        path: '/logistics/security/securityEventsRecord',
        name: 'securityEventsRecord',
        component: () => import('../views/logistics/security/securityEventsRecord.vue'),
        meta: {
          title: '安防事件'
        }
      },
      // {
      //   path: '/logistics/security/securityAccessory',
      //   name: 'securityAccessory',
      //   component: () => import('../views/logistics/security/securityAccessory.vue'),
      //   meta: {
      //     title: '安保附件'
      //   }
      // },
      {
        path: '/logistics/security/securityVisitRecord',
        name: 'securityVisitRecord',
        component: () => import('../views/logistics/security/securityVisitRecord.vue'),
        meta: {
          title: '来访登记'
        }
      },
      {
        path: '/logistics/security/securityThingsRecord',
        name: 'securityThingsRecord',
        component: () => import('../views/logistics/security/securityThingsRecord.vue'),
        meta: {
          title: '出入物品登记'
        }
      },
      {
        path: '/logistics/security/securityCartsRecord',
        name: 'securityCartsRecord',
        component: () => import('../views/logistics/security/securityCartsRecord.vue'),
        meta: {
          title: '车辆出入登记'
        }
      },
      {
        path: '/logistics/security/securityGroup',
        name: 'securityGroup',
        component: () => import('../views/logistics/security/securityGroup.vue'),
        meta: {
          title: '保安分组'
        }
      },
      {
        path: '/logistics/security/securityRounte',
        name: 'securityRounte',
        component: () => import('../views/logistics/security/securityRounte.vue'),
        meta: {
          title: '巡逻路线'
        }
      },
      {
        path: '/logistics/security/securityRounteDetail',
        name: 'securityRounteDetail',
        component: () => import('../views/logistics/security/securityRounteDetail.vue'),
        meta: {
          title: '巡逻路线详情'
        }
      },
      {
        path: '/logistics/security/securityRounteDetailMap',
        name: 'securityRounteDetailMap',
        component: () => import('../views/logistics/security/securityRounteDetailMap.vue'),
        meta: {
          title: '巡逻路线详情地图版'
        }
      },
      {
        path: '/logistics/security/securityArrange',
        name: 'securityArrange',
        component: () => import('../views/logistics/security/securityArrange.vue'),
        meta: {
          title: '保安排班'
        }
      },
      {
        path: '/logistics/security/securityRounteRank',
        name: 'securityRounteRank',
        component: () => import('../views/logistics/security/securityRounteRank.vue'),
        meta: {
          title: '巡逻打卡'
        }
      },
      {
        path: '/logistics/security/securityRounteRecord',
        name: 'securityRounteRecord',
        component: () => import('../views/logistics/security/securityRounteRecord.vue'),
        meta: {
          title: '巡逻记录'
        }
      },
      // 后勤管理-物业水电管理
      {
        path: '/logistics/dial/dial',
        name: 'dial',
        component: () => import('../views/logistics/dial/dial.vue'),
        meta: {
          title: '仪表信息'
        }
      },
      {
        path: '/logistics/dial/dialPrivate',
        name: 'dialPrivate',
        component: () => import('../views/logistics/dial/dialPrivate.vue'),
        meta: {
          title: '私表管理'
        }
      },
      {
        path: '/logistics/dial/dialPublic',
        name: 'dialPublic',
        component: () => import('../views/logistics/dial/dialPublic.vue'),
        meta: {
          title: '公表管理'
        }
      },
      // {
      //   path: '/logistics/dial/dialPublic',
      //   name: 'dialPublic',
      //   component: () => import('../views/logistics/dial/dialPublic.vue'),
      //   meta: {
      //     title: '公摊表信息'
      //   }
      // },
      // {
      //   path: '/logistics/dial/dialpublicRange',
      //   name: 'dialpublicRange',
      //   component: () => import('../views/logistics/dial/dialpublicRange.vue'),
      //   meta: {
      //     title: '公摊范围信息'
      //   }
      // },
      {
        path: '/logistics/dial/dialRecord',
        name: 'dialRecord',
        component: () => import('../views/logistics/dial/dialRecord.vue'),
        meta: {
          title: '抄表记录'
        }
      },
      // {
      //   path: '/logistics/dial/dialTotal',
      //   name: 'dialTotal',
      //   component: () => import('../views/logistics/dial/dialTotal.vue'),
      //   meta: {
      //     title: '总表信息'
      //   }
      // },
      // 后勤管理-车位管理
      {
        path: '/logistics/parking/parkBaseInfo',
        name: 'parkBaseInfo',
        component: () => import('../views/logistics/parking/parkBaseInfo.vue'),
        meta: {
          title: '车位基本信息档案'
        }
      },
      {
        path: '/logistics/parking/parkChargeStandard',
        name: 'parkChargeStandard',
        component: () => import('../views/logistics/parking/parkChargeStandard.vue'),
        meta: {
          title: '收费标准'
        }
      },
      {
        path: '/logistics/parking/parkCartInfo',
        name: 'parkCartInfo',
        component: () => import('../views/logistics/parking/parkCartInfo.vue'),
        meta: {
          title: '车辆基本信息档案'
        }
      },
      {
        path: '/logistics/parking/parkRecord',
        name: 'parkRecord',
        component: () => import('../views/logistics/parking/parkRecord.vue'),
        meta: {
          title: '车位停车记录'
        }
      },
      // 后勤管理-房屋租赁管理
      {
        path: '/logistics/rent/rentContract',
        name: 'rentContract',
        component: () => import('../views/logistics/rent/rentContract.vue'),
        meta: {
          title: '合同档案信息'
        }
      },
      // {
      //   path: '/logistics/rent/rentContractAccessory',
      //   name: 'rentContractAccessory',
      //   component: () => import('../views/logistics/rent/rentContractAccessory.vue'),
      //   meta: {
      //     title: '合同附件'
      //   }
      // },
      // 后勤管理-招商管理
      {
        path: '/logistics/shop/shopBaseInfo',
        name: 'shopBaseInfo',
        component: () => import('../views/logistics/shop/shopBaseInfo.vue'),
        meta: {
          title: '商铺资源基础信息档案'
        }
      },
      {
        path: '/logistics/shop/shopAdvertisement',
        name: 'shopAdvertisement',
        component: () => import('../views/logistics/shop/shopAdvertisement.vue'),
        meta: {
          title: '虚拟资源信息'
        }
      },
      // {
      //   path: '/logistics/shop/shopAdvertisementRentRecord',
      //   name: 'shopAdvertisementRentRecord',
      //   component: () => import('../views/logistics/shop/shopAdvertisementRentRecord.vue'),
      //   meta: {
      //     title: '虚拟资源租用记录'
      //   }
      // },
      {
        path: '/logistics/shop/shopCustomerInfo',
        name: 'shopCustomerInfo',
        component: () => import('../views/logistics/shop/shopCustomerInfo.vue'),
        meta: {
          title: '客户信息'
        }
      },
      {
        path: '/logistics/shop/shopCustomerPurpose',
        name: 'shopCustomerPurpose',
        component: () => import('../views/logistics/shop/shopCustomerPurpose.vue'),
        meta: {
          title: '客户意向'
        }
      },
      {
        path: '/logistics/shop/shopIntermediaryInfo',
        name: 'shopIntermediaryInfo',
        component: () => import('../views/logistics/shop/shopIntermediaryInfo.vue'),
        meta: {
          title: '中介信息'
        }
      },

      // 信息中心管理-短信服务平台
      {
        path: '/messageCenter/message/messageTemplate',
        name: 'messageTemplate',
        component: () => import('../views/messageCenter/message/messageTemplate.vue'),
        meta: {
          title: '短信模板'
        }
      },
      {
        path: '/messageCenter/message/messageRecord',
        name: 'messageRecord',
        component: () => import('../views/messageCenter/message/messageRecord.vue'),
        meta: {
          title: '短信记录'
        }
      },

      // 系统参数管理-账号角色设置
      {
        path: '/system/role/systemMenuManagement',
        name: 'systemMenuManagement',
        component: () => import('../views/system/role/systemMenuManagement.vue'),
        meta: {
          title: '菜单管理'
        }
      },
      {
        path: '/system/role/systemUser',
        name: 'systemUser',
        component: () => import('../views/system/role/systemUser.vue'),
        meta: {
          title: '系统用户'
        }
      },
      {
        path: '/system/role/systemRole',
        name: 'systemRole',
        component: () => import('../views/system/role/systemRole.vue'),
        meta: {
          title: '系统角色'
        }
      },
      {
        path: '/system/role/systemMenu',
        name: 'systemMenu',
        component: () => import('../views/system/role/systemMenu.vue'),
        meta: {
          title: '系统菜单'
        }
      },
      {
        path: '/system/role/systemMenuChildren',
        name: 'systemMenuChildren',
        component: () => import('../views/system/role/systemMenuChildren.vue'),
        meta: {
          title: '系统二级菜单'
        }
      },
      {
        path: '/system/role/systemRoleMenuChildren',
        name: 'systemRoleMenuChildren',
        component: () => import('../views/system/role/systemRoleMenuChildren.vue'),
        meta: {
          title: '角色与二级菜单关联表'
        }
      },
      {
        path: '/system/role/systemCommunityRole',
        name: 'systemCommunityRole',
        component: () => import('../views/system/role/systemCommunityRole.vue'),
        meta: {
          title: '小区角色'
        }
      },
      {
        path: '/system/role/systemCommunityRoleMenuChildren',
        name: 'systemCommunityRoleMenuChildren',
        component: () => import('../views/system/role/systemCommunityRoleMenuChildren.vue'),
        meta: {
          title: '小区角色与二级菜单关联表'
        }
      },
      {
        path: '/system/role/systemUserRole',
        name: 'systemUserRole',
        component: () => import('../views/system/role/systemUserRole.vue'),
        meta: {
          title: '用户系统角色（平台管理员）'
        }
      },
      {
        path: '/system/role/systemUserCommunityRole',
        name: 'systemUserCommunityRole',
        component: () => import('../views/system/role/systemUserCommunityRole.vue'),
        meta: {
          title: '用户小区角色(社区管理员）'
        }
      },
      {
        path: '/system/role/systemMenuAndRight',
        name: 'systemUserCommusystemMenuAndRightnityRole',
        component: () => import('../views/system/role/systemMenuAndRight.vue'),
        meta: {
          title: '系统菜单与权限管理'
        }
      },
      { path: '/house/houseChange/change', component: Change },
      { path: '/house/houseCount/houseFile', component: HouseFile },
      { path: '/house/stateCount/build', component: Build },
      { path: '/house/stateCount/unit', component: Unit },
      { path: '/owner/ownerHouse/comeInRecord', component: ComeInRecord },
      { path: '/owner/eventManage/eventRepair', component: EventRepair },
      { path: '/administrative/financial/chargeList', component: ChargeList },
      { path: '/administrative/financial/refundRecord', component: RefundRecord },
      { path: '/owner/eventManage/complainAdvice', component: ComplainAdvice },
      { path: '/owner/eventManage/complainItem', component: ComplainItem },
      { path: '/administrative/financial/chargeRecord', component: ChargeRecord },
      { path: '/administrative/financial/chargeProject', component: ChargeProject },
      { path: '/administrative/financial/chargeWays', component: ChargeWays },
      { path: '/administrative/financial/payInfo', component: PayInfo },
      { path: '/administrative/financial/incomeInfo', component: IncomeInfo },
      { path: '/owner/familyMember/familyInfo', component: FamilyInfo },
      { path: '/owner/reportManage/dialPrivate', component: DialPrivate },
      { path: '/owner/reportManage/dialRecord', component: DialRecord },
      { path: '/administrative/attendance/department', component: Department },
      { path: '/administrative/attendance/station', component: Station },
      { path: '/administrative/attendance/clerk', component: Clerk },
      { path: '/administrative/attendance/records', component: Records },
      { path: '/logistics/materialhouse/material', component: Material },
      { path: '/logistics/materialhouse/materialTwo', component: MaterialTwo },
      { path: '/logistics/materialhouse/materialIn', component: MaterialIn },
      { path: '/logistics/materialhouse/materialOut', component: MaterialOut },
      { path: '/logistics/materialhouse/materialBuy', component: MaterialBuy },
      { path: '/logistics/materialhouse/inventory', component: Inventory },
      { path: '/logistics/materialhouse/houseInfo', component: HouseInfo },
      { path: '/administrative/office/fileManage', component: FileManage },
      { path: '/administrative/office/filePermission', component: FilePermission },
      { path: '/administrative/office/employeeContract', component: EmployeeContract },
      { path: '/administrative/office/notice', component: Notice },
      { path: '/administrative/office/workPlan', component: WorkPlan },
      { path: '/administrative/office/meetingRecord', component: MeetingRecord },
      { path: '/refresh', component: refresh },

    ]
  }

]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

//挂载路由导航守卫
router.beforeEach((to, from, next) => {
  // to将要访问的路径
  // from代表从哪个路径跳转而来
  // next是一个函数，表示放行
  // next() 放行，next('/login') 强制跳转
  if (to.path === '/login') return next()
  // 获取token
  const tokenStr = window.sessionStorage.getItem('token')
  if (!tokenStr) return next('/login')
  next()
})

export default router
